﻿using IceCS.DesignPattern.Core.AbstractFactoryPattern.WorldThings.Colors;

namespace IceCS.DesignPattern.Core.AbstractFactoryPattern.WorldThings
{
    /// <summary>
    /// 颜色类型
    /// </summary>
    public enum ColorType
    {
        Red,
        Yellow,
        Blue,
        Green
    }

    /// <summary>
    /// 颜色工厂
    /// </summary>
    public class ColorFactory : WorldThingsFactory
    {
        public override IShapeAction GetShape(ShapeType type)
        {
            return null;
        }

        public override IColorAction GetColor(ColorType type)
        {
            return type switch
            {
                ColorType.Red => new Red(),
                ColorType.Yellow => new Yellow(),
                ColorType.Blue => new Blue(),
                ColorType.Green => new Green(),
                _ => null,
            };
        }
    }
}

